﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" CodeFile="Login.aspx.cs" Inherits="Login" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" src="Scripts/SHA1.js"></script>
    <table class="style2">
        <tr>
            <td class="style6" align="center" colspan="2">
                <asp:Label ID="Label2" runat="server" Text="Please  "></asp:Label>
                <asp:LinkButton ID="RegisterLink" runat="server" 
                    PostBackUrl="~/Register.aspx" Width="49px">register</asp:LinkButton>
                <asp:Label ID="Label1" runat="server" Text="if you don't have an account"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style7">
                Username:</td>
            <td class="style3">
                <asp:TextBox ID="UsernameTextBox" runat="server" Width="170px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style7">
                Password:</td>
            <td class="style3">
                <asp:TextBox ID="PasswordTextBox" runat="server" TextMode="Password" 
                    Width="170px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style5" align="center" colspan="2">
                <asp:Label ID="FieldProblemLabel" runat="server" ForeColor="#FF3300" 
                    Text="Label" Visible="False"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style4" align="center" colspan="2" valign="bottom">
                <asp:Button ID="LoginButton" runat="server" Text="Login" Width="77px" 
                    onclick="LoginButton_Click" OnClientClick="encrypt()"/>
            </td>
        </tr>
    </table>
    <script type="text/javascript">
        function encrypt() {
            var p = document.getElementById("MainContent_PasswordTextBox").value;
            document.getElementById("MainContent_PasswordTextBox").value = SHA1(p);
        }

    </script>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        SelectMethod="login" 
        TypeName="ForumLibrary.Data.ForumWebManager" 
        onobjectcreating="ObjectDataSource1_ObjectCreating">
        <SelectParameters>
            <asp:ControlParameter ControlID="UsernameTextBox" Name="username" 
                PropertyName="Text" Type="String" />
            <asp:ControlParameter ControlID="PasswordTextBox" Name="password" 
                PropertyName="Text" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    </asp:Content>
